/*


	作者：怼烎
	QQ：1395961821
	时间：2017.10.10


*/

$(function () {

	/*单选*/
	var  inu = $('.i');
	var address = $('.address');
	var li = $('li');

	$('section menu li:first-child').css('background','#eee');
	$('section menu li:first-child i').attr('class','ihover');
	$('section menu li:first-child .address').attr("checked",true);

	$.each(li,function(){
		/*console.log(this);*/
		$(this).click(function(j){
			$.each(li,function(i){
				/*console.log(this);*/
				$(this).css('background','');
				inu.eq(i).attr('class','i');
				address.eq(i).attr("checked",false);
				/*var a = address.eq(i).is(':checked');
				console.log(a);*/
			});
			$(this).css('background','#eee');
			$(this).find('.i').attr('class','ihover');
		});
	});


	/*删除*/
    var del = $('.del');
    $.each(del,function (){
    	$(this).click(function(){
    		var _this = this;
    		var __this = $(this);
    		layer.confirm('是否确定删除此收货地址?', {icon: 3, title:'删除'},function(index){
    			//删除节点
    			__this.parent().parent().parent().remove();
    			var url = _this.href;
    			$.ajax({
    				type:"get",
    				url : url,
    			})
    			layer.close(index);
    		})
    		return false;
    	});
    });
});